<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/interno.xhtml">
	<ui:define name="corpo">

		<f:loadBundle var="msg" basename="mensagens" />
		<h:form id="frmVen">

			<h:inputHidden value="#{vendedorBean.vendedor.codigo}" />

			<h:panelGrid columns="3" id="cli">

				<h:outputLabel value="CPF/CNPJ:" for="cpfCnpj1"
					rendered="#{vendedorBean.renderOutput}" />
				<h:outputText id="cpfCnpj1" value="#{vendedorBean.vendedor.cnpjCpf}"
					rendered="#{vendedorBean.renderOutput}" />
				<p:message id="msgCpfCnpj1" for="cpfCnpj"
					rendered="#{vendedorBean.renderOutput}" />

				<h:outputLabel value="CPF/CNPJ:" for="cpfCnpj"
					rendered="#{vendedorBean.renderInput}" />
				<p:inputText id="cpfCnpj" required="true"
					requiredMessage="#{msg.msgCampo}"
					value="#{vendedorBean.vendedor.cnpjCpf}" size="14" maxlength="14"
					style="font-size:15px" rendered="#{vendedorBean.renderInput}">
					<f:ajax event="change" listener="#{vendedorBean.validaCpjCnpj}"
						render="frmVen cpfCnpj" />
				</p:inputText>
				<p:message id="msgCpfCnpj" for="cpfCnpj"
					rendered="#{vendedorBean.renderInput}" />


				<h:outputLabel value="RG/Inscr. Est.:" for="rgIe" />
				<p:inputText id="rgIe" value="#{vendedorBean.vendedor.inscEstRg}"
					size="14" style="font-size:15px" maxlength="15">
				</p:inputText>
				<p:message id="msgRgIe" for="rgIe" />


				<h:outputLabel value="Nome/Razão Social:" for="nomeRsocial" />
				<p:inputText id="nomeRsocial" required="true"
					requiredMessage="#{msg.msgCampo}"
					value="#{vendedorBean.vendedor.nomeRsocial}" maxlength="50"
					size="53" style="font-size:15px" />

				<p:message id="msgNomeRsocial" for="nomeRsocial" />


				<h:outputLabel value="Endereço:" for="endereco" />
				<p:inputText id="endereco" required="true"
					requiredMessage="#{msg.msgCampo}"
					value="#{vendedorBean.vendedor.endereco}" size="53"
					style="font-size:15px" maxlength="50" />
				<p:message id="msgEndereco" for="endereco" />

				<h:outputLabel value="Bairro:" for="bairro" />
				<p:inputText id="bairro" value="#{vendedorBean.vendedor.bairro}"
					required="true" requiredMessage="#{msg.msgCampo}" size="30"
					style="font-size:15px" maxlength="30" />
				<p:message id="msgBairro" for="bairro" />

				<h:outputLabel value="CEP:" for="cep" />
				<p:inputMask mask="99.999-999" id="cep" required="true"
					requiredMessage="#{msg.msgCampo}"
					value="#{vendedorBean.vendedor.cep}" size="7"
					style="font-size:15px" />
				<p:message id="msgCep" for="cep" />

				<h:outputLabel value="Cidade:" for="cidade" />
				<p:inputText id="cidade" required="true"
					requiredMessage="#{msg.msgCampo}"
					value="#{vendedorBean.vendedor.cidade}" size="53"
					style="font-size:15px" maxlength="50" />
				<p:message id="msgCidade" for="cidade" />

				<h:outputLabel value="UF:" for="uf" />
				<p:inputMask mask="aa" id="uf" value="#{vendedorBean.vendedor.uf}"
					required="true" requiredMessage="#{msg.msgCampo}" maxlength="2"
					size="1" style="font-size:15px" />
				<p:message id="msgUf" for="uf" />

				<h:outputLabel value="Telefone:" for="telefone" />
				<p:inputMask mask="(99) 9999-9999" id="telefone"
					value="#{vendedorBean.vendedor.telefone}" size="11"
					style="font-size:15px" />
				<p:message id="msgTelefone" for="telefone" />

				<h:outputLabel value="Celular:" for="celular" />
				<p:inputMask mask="(99) 9999-9999" id="celular"
					value="#{vendedorBean.vendedor.celular}" size="11"
					style="font-size:15px" />
				<p:message id="msgCelular" for="celular" />

				<h:outputLabel value="Fax:" for="fax" />
				<p:inputMask mask="(99) 9999-9999" id="fax"
					value="#{vendedorBean.vendedor.fax}" size="11"
					style="font-size:15px" />
				<p:message id="msgFax" for="fax" />

				<h:outputLabel value="E-mail:" for="email" />
				<p:inputText id="email" value="#{vendedorBean.vendedor.email}"
					size="53" style="font-size:15px" maxlength="53"
					validatorMessage="#{msg.emailInvalido}">
					<f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
				</p:inputText>
				<p:message id="msgEmail" for="email" />

				<h:outputLabel value="Contato:" for="contato" />
				<p:inputText id="contato" value="#{vendedorBean.vendedor.contato}"
					size="18" style="font-size:15px" maxlength="20" />
				<p:message id="msgContato" for="contato" />

				<h:outputLabel value="Banco:" for="banco" />
				<p:inputText id="banco" value="#{vendedorBean.vendedor.banco}"
					size="14" style="font-size:15px" maxlength="20" />
				<p:message id="msgBanco" for="banco" />
				<h:outputLabel value="Observação:" for="obs" />
				<p:inputTextarea id="obs"
					value="#{vendedorBean.vendedor.observacao}"
					style="font-size:15px;width:300px" />
				<p:message id="msgObs" for="obs" />

			</h:panelGrid>

			<p:commandButton action="#{vendedorBean.salvar}" value="Salvar"
				update="cli" />&nbsp;
	<p:commandButton action="vendedorListar" value="Cancelar"
				immediate="true" />

		</h:form>

	</ui:define>

</ui:composition>
</html>
